#ifndef TEXTCHUNK
#define TEXTCHUNK

#include <string>
using namespace std;

/**
 * Part of MODEL of MVC
 * stores all relevent information for the textual information of the PNG image
 * that will be re-written
 */
class TextChunk
{
private:
	/*
	 * All fields are string objects because pnglib requires everything to be
	 * written as text
	 */
	//9 string pointers
	string *title, *author, *description, *copyright, *creation_time,
		   *software, *disclaimer, *source, *comment;
	
	/**
	 * Stores references to all string pointers to be returned
	 * from getAllStrings()
	 */
	string** strArray;
	
public:
	
	/**
	 * This returns REFERENCES to all fields
	 * to delete them, delete the TextChunk object they were
	 * acquired from
	 * This is to avoid memory leaks from returning -new- objects
	 * from a method
	 */
	string** getAllStrings();
	
	
	/**
	 * Pass an array of 9 string pointers, one pointer for each field
	 * the fields will be MEMORY COPIED, NOT REFERENCE COPIED.  It is
	 * safe to delete passed pointers
	 */
	TextChunk(string**);
	
	/**
	 * Manually pass each field.  Like the above, all pointers will be DE-REFERENCED AND COPIED,
	 * NOTE REFERENCE COPIED.  It is safe to delete passed pointers.
	 */
	TextChunk(string *TITLE, string *AUTHOR, string *DESCRIPTION,
			 string *COPYRIGHT, string *CREATION_TIME,
			 string *SOFTWARE, string *DISCLAIMER, 
			 string *SOURCE, string *COMMENT);
	
	//DTOR- delete all string fields
	~TextChunk();
	
	/**
	 * Will read an object of TextChunk from a file and return it
	 * Will be allocated on the stack
	 */
	static TextChunk readTextChunk(string* filename);
	
	/**
	 * Stores the filename that readTextChunk will use to return
	 * an object
	 */
	static string      defaultsFilename;
};


#endif